import { sourcingRequest } from '@api/service/sourcing';
/**
 * 自进货列表页
**/
// 自进货询价 - 列表查询
export const querySelfPurchaseListService = (data, loadingFn) => sourcingRequest({
  url: 'selfPurchaseBill/getSelfPurchaseBillListPage',
  type: 'post',
  data,
  loadingFn
})

// 自进货询价 - 导出表格数据
export const exportSelfPurchaseListService = (data, loadingFn) => sourcingRequest({
  url: 'selfPurchaseBill/exportSelfPurchaseBillPage',
  type: 'post',
  data,
  loadingFn,
  isExport: true
})

// 自进货询价 - 询价取消
export const cancelInquiryService = (data, loadingFn) => sourcingRequest({
  url: 'selfPurchaseBill/updateBillStatus',
  type: 'post',
  data,
  loadingFn,
})

// 自进货询价 - 生成订单校验是否潜在供应商
export const generateOrderService = (data, loadingFn) => sourcingRequest({
  url: 'purchaseOrder/checkSupplier',
  type: 'post',
  data,
  loadingFn,
})

// 自进货询价 - 重新询价
export const reinquiryService = (data, loadingFn) => sourcingRequest({
  url: 'selfPurchaseBill/afreshSelfPurchaseBill',
  type: 'post',
  data,
  loadingFn,
})

// 自进货询价 - 审批流
export const getOAInfoService = (data, loadingFn) => sourcingRequest({
  url: 'sourceBill/OAQueryInfor',
  type: 'get',
  data,
  loadingFn,
})

/**
 * 报价信息
**/
// 单据供应商列表
export const queryBillSupplierService = (data, loadingFn) => sourcingRequest({
  url: 'selfPurchaseBill/querySelfPurchaseSupplier',
  type: 'get',
  data,
  loadingFn,
})

// 添加供应商
export const addBillSupplierService = (data, loadingFn) => sourcingRequest({
  url: 'sourceSupplier/selfPurchaseAddSupplier',
  type: 'POST',
  data,
  loadingFn,
})

// 删除供应商
export const deleteBillSupplierService = (data, loadingFn) => sourcingRequest({
  url: 'sourceSupplier/delSupplier',
  type: 'get',
  data,
  loadingFn,
})

// 推送询价单
export const pushInquiryService = (data, loadingFn) => sourcingRequest({
  url: 'sourceSupplier/selfPurchasePushScm',
  type: 'POST',
  data,
  loadingFn,
})

// 单据基本信息
export const queryBillBaseService = (data, loadingFn) => sourcingRequest({
  url: 'selfPurchaseBill/querySelfPurchaseBase',
  type: 'get',
  data,
  loadingFn,
})

// 保存附件
export const saveFileGroupIdService = (data, loadingFn) => sourcingRequest({
  url: 'selfPurchaseBill/saveFileGroupId',
  type: 'POST',
  data,
  loadingFn,
})

// 单据商品信息
export const queryBillGoodsService = (data, loadingFn) => sourcingRequest({
  url: 'selfPurchaseBill/querySelfPurchaseSku',
  type: 'get',
  data,
  loadingFn,
})

// 单据商品 - 删除
export const deleteBillGoodsService = (data, loadingFn) => sourcingRequest({
  url: 'selfPurchaseBill/batchDeleteSelfDetailProduct',
  type: 'post',
  data,
  loadingFn,
})

// 报价信息 - 报价详情明细
export const queryQuoteDetailService = (data, loadingFn) => sourcingRequest({
  url: 'selfPurchaseBill/getSelfSupplyInquiryDetail',
  type: 'post',
  data,
  loadingFn,
})

// 报价信息 - 报价计算成本
export const calcCostPriceService = (data, loadingFn) => sourcingRequest({
  url: 'sourceSkuQuote/calcCostPrice',
  type: 'POST',
  data,
  loadingFn,
})

// 报价信息 - 报价计算辅数量
export const calcAssistNumService = (data, loadingFn) => sourcingRequest({
  url: 'selfPurchaseBill/calcAssistNum',
  type: 'POST',
  data,
  loadingFn,
})

// 报价信息 - 供应商暂存
export const temporarySaveService = (data, loadingFn) => sourcingRequest({
  url: 'sourceSupplier/selfPurchaseCompleteQuoteSaveTemp',
  type: 'POST',
  data,
  loadingFn,
})

// 报价信息 - 供应商报价完成
export const finishQuoteService = (data, loadingFn) => sourcingRequest({
  url: 'sourceSupplier/selfPurchaseCompleteQuote',
  type: 'POST',
  data,
  loadingFn,
})

// 单据完成报价
export const finishBillQuoteService = (data, loadingFn) => sourcingRequest({
  url: 'selfPurchaseBill/selfPurchaseQuoteComplete',
  type: 'POST',
  data,
  loadingFn,
})

// 定标详情
export const queryCalibrationInfoService = (data, loadingFn) => sourcingRequest({
  url: 'selfPurchaseBill/queryWinBiddingOrder',
  type: 'get',
  data,
  loadingFn,
})

// 定标 - 校验异常类型
export const checkExceptionTypeService = (data, loadingFn) => sourcingRequest({
  url: 'selfPurchaseBill/selfPurchaseCalibrateCompleteStep1',
  type: 'POST',
  data,
  loadingFn,
})

// 定标 - 校验要货数量是否超1.2倍
export const checkAmountService = (data, loadingFn) => sourcingRequest({
  url: 'selfPurchaseBill/selfPurchaseCalibrateCompleteStep2',
  type: 'POST',
  data,
  loadingFn,
})

// 定标 - 要货数量超1.2倍 定标
export const overCalibrationService = (data, loadingFn) => sourcingRequest({
  url: 'selfPurchaseBill/selfPurchaseCalibrateCompleteStep3',
  type: 'POST',
  data,
  loadingFn,
})

// 定标 - 获取异常类型对应异常原因及填写说明
export const queryExpInfoByExpIdService = (data, loadingFn) => sourcingRequest({
  url: 'selfPurchaseBill/queryExceptionType',
  type: 'POST',
  data,
  loadingFn,
})

// 定标 - 查看详情
export const queryCalibrationDetailService = (data, loadingFn) => sourcingRequest({
  url: 'oaInfo/getOaInfoById',
  type: 'get',
  data,
  loadingFn,
})

// 下推订货单 - 提交
export const submitSelfPurchaseOrderService = (data, loadingFn) => sourcingRequest({
  url: '/purchaseOrder/selfPurchaseSendPurchaseOrder',
  type: 'POST',
  data,
  loadingFn,
})
